//
//  Singleton.m
//  单例
//
//  Created by 杨利佳 on 15/5/15.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "Singleton.h"
#import <StreamingKit/STKAudioPlayer.h>


static Singleton *single = nil;

@implementation Singleton

- (void)dealloc
{
    [_state release];
    [_state release];
    [_streamer release];
    [super dealloc];
}


+ (Singleton *)shareManager
{
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        
        if (!single) {
            
            single = [[Singleton alloc] init];
        }
        
    });
    return single;
}

- (void)playWithUrl:(NSString *)url
{
    [self stop];
    self.streamer = [[STKAudioPlayer alloc] init];
    [self.streamer play:url];
}

- (void)stop
{
    if (self.streamer) {
        [self.streamer stop];
    }
}

@end
